package com.cskaoyan.market.controller;

import com.cskaoyan.market.db.domain.MarketComment;
import com.cskaoyan.market.db.domain.MarketUser;
import com.cskaoyan.market.service.WxCommentService;
import com.cskaoyan.market.util.ResponseUtil;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Author: 付诚
 * @Date: 2024/5/21 21:53
 * @Description:
 */
@RestController
@RequestMapping("wx/comment")
public class WxCommentController {
    @Autowired
    WxCommentService wxCommentService;

    @GetMapping("list")
    public Object list(Integer valueId, Byte type, Integer limit, Integer page, Integer showType) {


        List<Object> list = wxCommentService.list(valueId, type, limit, page, showType);
        return ResponseUtil.okList(list);
    }

    @GetMapping("count")
    public Object count(Integer valueId, Byte type) {

        Map<String, Object> data = wxCommentService.count(valueId, type);
        return ResponseUtil.ok(data);
    }

    @PostMapping("post")
    public Object post(@RequestBody MarketComment comment) {


        MarketComment result = wxCommentService.post(comment);

        return ResponseUtil.ok(result);
    }
}
